#!/usr/bin/env python3

# Copyright 2022 Modern Electron, David Grote

import os
import sys

import numpy as np

sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

# fmt: off
ref_density = np.array([
       1.27989677e+14, 2.23601330e+14, 2.55400265e+14, 2.55664972e+14,
       2.55806841e+14, 2.55806052e+14, 2.55815865e+14, 2.55755151e+14,
       2.55920582e+14, 2.56078972e+14, 2.55933056e+14, 2.55840862e+14,
       2.56043990e+14, 2.56247464e+14, 2.56289153e+14, 2.56277109e+14,
       2.56242679e+14, 2.56328850e+14, 2.56373595e+14, 2.56395979e+14,
       2.56451842e+14, 2.56601614e+14, 2.56530735e+14, 2.56113125e+14,
       2.56207966e+14, 2.56474622e+14, 2.56378743e+14, 2.56230373e+14,
       2.56271563e+14, 2.56317460e+14, 2.56137709e+14, 2.56104767e+14,
       2.56244330e+14, 2.56188574e+14, 2.56070283e+14, 2.56212277e+14,
       2.56374214e+14, 2.56309276e+14, 2.56199679e+14, 2.56227549e+14,
       2.56434824e+14, 2.56578649e+14, 2.56418136e+14, 2.56781877e+14,
       2.57464056e+14, 2.57125505e+14, 2.56477914e+14, 2.56355343e+14,
       2.56599651e+14, 2.56955102e+14, 2.56988933e+14, 2.56954167e+14,
       2.56848084e+14, 2.56278229e+14, 2.55969967e+14, 2.56075186e+14,
       2.56011026e+14, 2.56054081e+14, 2.56203573e+14, 2.56131373e+14,
       2.56181410e+14, 2.56460942e+14, 2.56519893e+14, 2.56394874e+14,
       2.56273725e+14, 2.56263570e+14, 2.56463482e+14, 2.56541354e+14,
       2.56467160e+14, 2.56523576e+14, 2.56760359e+14, 2.56899283e+14,
       2.56889333e+14, 2.56984101e+14, 2.57009449e+14, 2.57017095e+14,
       2.57027915e+14, 2.57002409e+14, 2.56938087e+14, 2.56604366e+14,
       2.56392558e+14, 2.56481669e+14, 2.56337220e+14, 2.56107563e+14,
       2.56286144e+14, 2.56451638e+14, 2.56547674e+14, 2.56846908e+14,
       2.56725251e+14, 2.56321829e+14, 2.56387226e+14, 2.56750085e+14,
       2.56775478e+14, 2.56589827e+14, 2.56723109e+14, 2.56698688e+14,
       2.56674607e+14, 2.57128951e+14, 2.57144972e+14, 2.56602827e+14,
       2.56564415e+14, 2.56824494e+14, 2.56459673e+14, 2.56106618e+14,
       2.56442627e+14, 2.57106509e+14, 2.57468066e+14, 2.57155708e+14,
       2.56501993e+14, 2.56062276e+14, 2.56109738e+14, 2.56284272e+14,
       2.56320557e+14, 2.56253594e+14, 2.56155365e+14, 2.56044920e+14,
       2.55994560e+14, 2.56166612e+14, 2.56327633e+14, 2.56390898e+14,
       2.56474891e+14, 2.56669566e+14, 2.56646041e+14, 2.56264156e+14,
       2.56041610e+14, 2.56041551e+14, 2.56088641e+14, 2.23853646e+14,
       1.27580207e+14
])
# fmt: on

density_data = np.load("ion_density_case_1.npy")
print(repr(density_data))
assert np.allclose(density_data, ref_density)

# compare checksums
evaluate_checksum(
    test_name=os.path.split(os.getcwd())[1],
    output_file=sys.argv[1],
)
